﻿#ifndef PST_SURFACEELECTRICFIELDMAPSETTINGDATA_H
#define PST_SURFACEELECTRICFIELDMAPSETTINGDATA_H

#include <QObject>
#include <QColor>
#include <QDomNodeList>
#include <QDomElement>
#include <QDomText>
#include <QDomAttr>
#include "ScalarBarSettingData.h"

namespace pst
{
    class GeometrySettingData : public QObject
    {
        Q_OBJECT
    public:
        GeometrySettingData(QObject* parent = nullptr);
    public:
        //====GeometrySettingData====//
        void setGeometryTransparency(int transparency);
        int getGeometryTransparency() const;

        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isdiso = false);

    private:
        int m_transparency = 0;
    };

    class ResultDataSettingData : public QObject
    {
        Q_OBJECT
    public:
        ResultDataSettingData(QObject* parent = nullptr);
    public:
        //====resultDataSettingData====//
        void setResultDataName(QString resultName);
        QString getResultDataName() const;

        void setResultDataTransparency(int transparency);
        int getResultDataTransparency() const;

        void setResultDataScaleFactor(double scaleFactor);
        double getResultDataScaleFactor() const;

        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isdiso = false);

    private:
        QString m_resultName = "";
        int m_transparency = 0;
        double m_scaleFactor = 1.0;
    };

    class CubeAxesActorSettingData : public QObject
    {
        Q_OBJECT
    public:
        CubeAxesActorSettingData(QObject* parent = nullptr);

    public:
        void setVisibility(bool isVis);
        bool getVisibility() const;

        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isFormWindow, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isFormWindow, bool isdiso = false);

    private:
        bool m_isVisibility = false;
    };

    class SurfaceElectricFieldMapSettingData : public QObject
    {
        Q_OBJECT

    public:
        SurfaceElectricFieldMapSettingData(QObject* parent, int id);
        ~SurfaceElectricFieldMapSettingData();

        int getID() const;

        void setScalarBarSettingData(ScalarBarSettingData* scalarBarSettingData);
        ScalarBarSettingData* getScalarBarSettingData() const;

        void setGeometrySettingData(GeometrySettingData* geometrySettingData);
        GeometrySettingData* getGeometrySettingData() const;

        void setResultDataSettingData(ResultDataSettingData* resultDataSettingData);
        ResultDataSettingData* getResultDataSettingData() const;

        void setCubeAxesActorSettingData(CubeAxesActorSettingData* cubeAxesActorSettingData);
        CubeAxesActorSettingData* getCubeAxesActorSettingData();

        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isdiso = false);

    private:
        ScalarBarSettingData* m_scalarBarSettingData;
        GeometrySettingData* m_geometrySettingData;
        ResultDataSettingData* m_resultDataSettingData;
        CubeAxesActorSettingData* m_cubeAxesActorSettingData;
        int m_id = 0;
    };
}

#endif
